package com.zha.boss.mvc.convert;

import com.zha.boss.dao.entity.UserPayConfig;
import com.zha.boss.dao.entity.UserPayInfo;
import com.zha.boss.mvc.models.vo.UserPayConfigVo;
import com.zha.boss.mvc.models.vo.UserPayInfoVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.Named;

import java.util.List;

/**
 * @Author: zha
 * @CreateTime: 2024年09月17日 11:07
 */
@Mapper(componentModel = "spring")
public interface UserPayConfigConvert {
    @Mappings({
            @Mapping(source = "payProductCode",target = "productCode"),
            @Mapping(source = "payProductName",target = "productName"),
            @Mapping(source = "autoSett",target = "autoSett",qualifiedByName = "tranAutoSett"),
            @Mapping(source = "editTime",target = "editTime",dateFormat = "yyyy-MM-dd HH:mm:ss"),
    })
    UserPayConfigVo toUserPayConfigVo(UserPayConfig userPayConfig);
    List<UserPayConfigVo> toListUserPayConfigVo(List<UserPayConfig> userPayConfigList);
    List<UserPayInfoVo> toListUserPayInfoVo(List<UserPayInfo> userPayInfoList);
    @Named("tranAutoSett")
    default String tranAutoSett(String autoSett){
        if ("YES".equals(autoSett)){
            return "是";
        }else {
            return "否";
        }
    }
}
